package com.bbeginner.learn.no4;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.bbeginner.learn.R;
import com.bbeginner.learn.no4.practice.MenuContextActivity;
import com.bbeginner.learn.no4.practice.MenuOptionActivity;
import com.bbeginner.learn.no4.practice.ShoppingCartActivity;
import com.bbeginner.learn.no4.share.ShareWriteActivity;
import com.bbeginner.learn.no4.sql.LoginSQLiteActivity;

public class Main4Activity extends AppCompatActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main4);

        initView();
    }

    private void initView() {
        findViewById(R.id.btn_share_write).setOnClickListener(this);

        findViewById(R.id.btn_login_sqlite).setOnClickListener(this);
        findViewById(R.id.btn_menu_option).setOnClickListener(this);
        findViewById(R.id.btn_menu_context).setOnClickListener(this);
        findViewById(R.id.btn_shopping_cart).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.btn_share_write) {
            Intent intent = new Intent(this, ShareWriteActivity.class);
            startActivity(intent);

        } else if (v.getId() == R.id.btn_login_sqlite) {
            Intent intent = new Intent(this, LoginSQLiteActivity.class);
            startActivity(intent);

        } else if (v.getId() == R.id.btn_menu_option) {
            Intent intent = new Intent(this, MenuOptionActivity.class);
            startActivity(intent);
        } else if (v.getId() == R.id.btn_menu_context) {
            Intent intent = new Intent(this, MenuContextActivity.class);
            startActivity(intent);
        } else if (v.getId() == R.id.btn_shopping_cart) {
            Intent intent = new Intent(this, ShoppingCartActivity.class);
            startActivity(intent);
        }
    }
}